import random

from database.models import UserProfile

"""
    @TODO 编号工具类
"""


def create_user_no():
    num = random.randint(100000, 999999)
    is_exist = UserProfile.objects.filter(serial_code=num)
    while len(is_exist) != 0:
        num = create_user_no()
    return num
